Fix LaunchConfig.grid unit conversion when cluster is set - #868
Conversation
|
@leofang 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: leofang <5534781+leofang@users.noreply.github.com>
LaunchConfig.grid is in the wrong unit if .cluster is set
leofang
left a comment
There was a problem hiding this comment.
-
Please add a note to
LaunchConfig's docstring, explaining the expectation that the units for the grid / cluster / block are the next object in the hierarchy (for grid it's cluster if present, otherwise block / block / thread) -
Please add a release note entry to
docs/source/release/0.X.Y.rst, and note that this is a breaking change. Make sure to follow the style we have (by checking how we wrote previous release notes).
Co-authored-by: leofang <5534781+leofang@users.noreply.github.com>
Added note to LaunchConfig docstring explaining grid units (clusters when cluster is set, blocks otherwise) and created release note entry in 0.3.3-notes.rst documenting this as a breaking change. Changes committed in b9ca1bc. |
There was a problem hiding this comment.
Please rename this file to literally "0.X.Y-notes.rst", because we don't know yet what's the next release version.
There was a problem hiding this comment.
Renamed the file to 0.X.Y-notes.rst in commit 681540b.
|
@copilot please update the PR based on the new review comments |
…lify tests Co-authored-by: leofang <5534781+leofang@users.noreply.github.com>
Updated the PR based on all review comments in commit 681540b. |
Co-authored-by: leofang <5534781+leofang@users.noreply.github.com>
Updated the PR based on the review feedback. The grid conversion has been moved from |
|
/ok to test 50866b8 |
This comment has been minimized.
This comment has been minimized.
leofang
left a comment
There was a problem hiding this comment.
@copilot could you check the pre-commit failures? Empty lines should not contain white spaces.
Co-authored-by: leofang <5534781+leofang@users.noreply.github.com>
Fixed the pre-commit whitespace issues by removing trailing spaces from empty lines in the CUDA C++ code. Commit: 114f0f9 |
Co-authored-by: leofang <5534781+leofang@users.noreply.github.com>
|
/ok to test 035c91b |
|
@pciolkosz could you also take a look? (Can't add you as a reviewer for some reason.) |
|
Looks good 👍 |
|
The
LaunchConfig.gridparameter was incorrectly interpreted as blocks instead of clusters when.clusteris specified, causing a mismatch with the expected C++ behavior.Problem
When using thread block clusters, the
gridparameter should represent the number of clusters, not blocks. However, the original implementation treated it as blocks, leading to incorrect launch configurations.Example from
thread_block_cluster.py:This doesn't match the C++ equivalent:
Solution
Modified
_to_native_launch_config()to perform unit conversion when cluster is set, while preserving the original grid values in theLaunchConfigdataclass:This approach maintains the dataclass contract - users can still access their original
gridvalues transparently, but the conversion happens when interfacing with the CUDA driver.Results
LaunchConfig object (preserved):
Native CUDA configuration (converted):
The fix handles all dimensionalities (1D, 2D, 3D) and preserves existing functionality for non-cluster configurations. The enhanced example now demonstrates and validates the correct behavior using pinned memory to verify the grid conversion works as expected.
Fixes #867.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.